<template>
    <div>
        <!-- 标题 -->
        <navtitle title="分类列表"></navtitle>
        <!-- 卡片 -->
        <div v-for="item in searchApiData">
            <router-link :to="{ name: 'det', params: { goods_id: item.goods_id } }">
                <van-card :num="item.goods_number" :price="item.goods_price" :title="item.goods_name"
                    :thumb="item.goods_big_logo ? item.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
            </router-link>
        </div>

    </div>
</template>

<script setup>
import { useRoute } from 'vue-router';
const route = useRoute()
console.log(route.params.query);

// 标题
import navtitle from '@/components/navtitle.vue';

import { searchApi } from '@/api/api';
import { ref } from 'vue';
let searchApiData = ref([])
searchApi(route.params.query).then((res) => {
    console.log(res);
    searchApiData.value = res.data.message.goods
})
</script>

<style lang="scss" scoped></style>